#include "widget.h"
#include "ui_widget.h"

#include <QDebug>
#include <QPushButton>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    // 此处直接针对 widget 对象来使用 geometry 和 frameGrometry观察区别
    QRect r1 = this->geometry();
    QRect r2 = this->frameGeometry();
    qDebug() << r1;
    qDebug() << r2;

    QPushButton* button = new QPushButton(this);
    button->setText("按钮");
    button->move(100, 100);
    connect(button, &QPushButton::clicked, this, &Widget::handle);
}

void Widget::handle()
{
    QRect r1 = this->geometry();
    QRect r2 = this->frameGeometry();
    qDebug() << r1;
    qDebug() << r2;
}

Widget::~Widget()
{
    delete ui;
}

